<%--
  Created by IntelliJ IDEA.
  User: CY
  Date: 2018/1/4
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>主题教育</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8 ? MYOA_CHARSET : htmlspecialchars($HTML_PAGE_CHARSET))?>" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=0.3, user-scalable=0, minimum-scale=0, maximum-scale=5.0,user-scalable=yes">
    <link rel="stylesheet" type="text/css" href="/css/street/street.css"/>
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">
    <link rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/lib/laydate/need/laydate.css">
    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link rel="stylesheet" type="text/css" href="/css/patrol/patrol.css"/>
    <link rel="stylesheet" href="/css/base.css">
    <script src="../js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/layer/layer.js?20201106" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/tablePage.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <style>
        body{
            margin:0px;
        }
        .info{
            width:180px;
            height:28px;
            border-radius: 3px;
            margin-left:20px;
            vertical-align: middle;
        }
        button{
            background: #2f8ae3;
            margin-left: 10px;
            padding: 5px 10px;
            border-radius: 4px;
            color: #fff;
            cursor: pointer;
            font-size:14px;
        }
        #add{
            float:right;
            margin:0px 20px 0px 0px;
        }
        .table{
            width:96%;
            margin:5px auto 0px;
        }
        .tableFoot{
            margin-top:20px;
        }
        .childCheck{
            width:16px;
            vertical-align: middle;
        }
        #checkAll{
            margin-left:10px;
        }
        #outport{
            background: #cc0000;
        }
        #inportEdit{
            background: #009900;
        }
        .M-box3 .active{
            margin: 0px 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color:#fff;
            text-align:center;
            display: inline-block;
        }
        .M-box3 a{
            margin: 0 3px;
            width: 29px;
            height: 29px;
            line-height: 29px;
            font-size: 12px;
            display: inline-block;
            text-align:center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #bdbdbd;
            text-decoration: none;
        }
        .mainBg .mainTitle{
            min-width: 750px;
        }
        .mainTitleUl .bordercolor span{
            font-size:14px;
        }
        .mainTitleUl .bordercolor label input[type=text]{
            font-size:14px;
        }
        .mainBg{
            padding-top:0px;
        }
        #houseProperty{
            background: none!important;
        }
        /*#add{*/
        /*position: static!important;*/
        /*margin-bottom:10px!important;*/
        /*}*/
        ul li{
            padding-left:10px!important;
        }
        .lue{
            width:200px;
            overflow: hidden;
            margin:0 auto;
            text-overflow:ellipsis;
            white-space:nowrap;
        }
    </style>
    <link rel="stylesheet" href="/css/biaodan.css">
</head>
<body>
<div class="headTop" id="iframe13">
    <div class="headImg">
        <img src="/img/document/icon_agentDispatch.png" alt="">
    </div>
    <div class="divTitle">
        主题教育

    </div>
</div>
<div class="content" style="padding-top:80px;">
    <div class="tableList" >
        <div class="headNav">
            <%--<input type="text" class="info" placeholder="居委会名称">--%>
            <%--<button id="query">查询</button>--%>
            <%--<button id="inport">导入</button>--%>
            <%--<button id="inportEdit">导入修改</button>--%>
            <button class="choose" id="add" data-type="0" style="margin-top: 45px;margin-bottom: 4px;margin-right: 2.5%;float: right">新建</button>
        </div>
        <div class="table">
            <table>
                <thead>
                <tr>
                    <%--<th style="width:1%"></th>--%>
                    <th>序号</th>
                    <%--                    <th>社区名称</th>--%>
                    <th>活动时间</th>
                    <th>主题</th>
                    <th>活动内容</th>
                    <th>参加人员</th>
                    <th class="option"></th>
                </tr>
                </thead>
                <tbody class="list">

                </tbody>
            </table>
            <%--<div class="tableFoot">--%>
            <%--<input type="checkbox" id="checkAll"  style="width:16px;vertical-align: middle">--%>
            <%--<label for="checkAll" style="font-size:14px;">全选</label>--%>
            <%--<button id="outport">导出</button>--%>
            <%--</div>--%>
            <div style="margin: 0px auto 0px;height:50px;width: 97%;" class="clearfix">
                <div id="dbgz_page" class="M-box3" style="display: none">

                </div>
            </div>
        </div>
    </div>
    <div class="mainBg" style="background: #fff;display: none">
        <form action="" id="datasave">
            <input type="file"  onchange="filesTwo(this)" multiple="multiple" name="file"
                   style="display: none"/>
            <%--<input type="hidden" name="userId">--%>
            <%--<input type="hidden" name="checkId">--%>
            <div class="mainTitle">
                <ul class="mainTitleUl">
                    <li style="    padding-top: 18px;text-align: center;height: 0 !important;border-bottom: none !important;"><span class="spanSize"></span> </li>
                    <%--                    <li class="bordercolor clearfix">--%>
                    <%--                        <span style="border-bottom: 1px solid #fff;">社区名称<b style="color: red;">*</b></span>--%>
                    <%--                        <label style="width: 80%;">--%>
                    <%--                            <select name="community" id="gridName" style="width:92%;background: none;font-size:14px;"></select>--%>
                    <%--                        </label>--%>
                    <%--                    </li>--%>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">所属组织</span>
                        <label style="width: 80%;">
                            <select name="organize" id="organize" style="width:92%;background: none;font-size:14px;"></select>
                        </label>
                    </li>

                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">活动时间<b style="color: red;">*</b></span>
                        <label style="width: 80%;">
                            <input type="text" name="subjectTime" placeholder="请填写活动时间" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 9px;" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">主题<b style="color: red;">*</b></span>
                        <label style="width: 80%;">
                            <input type="text" name="subject" placeholder="请填写主题" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 9px;">
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;height: 105px;line-height: 105px">活动内容</span>
                        <label style="width: 80%;height: 105px;">
                            <textarea name="subjectContent" id="subjectContent"  placeholder="请填写活动内容" style="background: #fcfcfc;font-size:14px;margin-top:9px;"></textarea>
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;">参加人数</span>
                        <label style="width: 80%;">
                            <input type="text" name="joinNum" placeholder="请填写参加人数" style="background: #fcfcfc;    width: 92%;
    float: none;
    margin-top: 9px;">
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;height: 100px;line-height: 100px">照片</span>
                        <label style="width: 80%;height: 100px;">
                            <div class="picture prevTwo" style="position: relative;width: 89%">
                                <input type="hidden" name="attachmentId">
                                <%--<a class="fl addPhotos" href="javascript:void (0)" ></a>--%>
                                <img class="fl addPhotos" style="    width: 60px;cursor: pointer;
    height: 60px;
    margin-top: 4px;
    margin-right: 7px;" src="/img/grid/addtupin.png" alt="添加照片">
                                <input type="hidden" name="attachmentName">

                                <ul class="fl">

                                </ul>

                            </div>
                        </label>
                    </li>
                    <li class="bordercolor clearfix">
                        <span style="border-bottom: 1px solid #fff;height: 105px;line-height: 105px">备注</span>
                        <label style="width: 80%;height: 105px;">
                            <textarea name="remark" id="remark"  placeholder="请填写备注" style="background: #fcfcfc;font-size:14px;margin-top:9px;"></textarea>
                        </label>
                    </li>


                </ul>
                <div style="height: 88px;line-height: 88px;text-align: center">
                    <a href="javascript:void (0)" class="preservation" style="
                margin-top: 25px;display: inline-block;margin-right: 10px;
                line-height: 1;font-size:18px;padding: 8px 20px;
                background: #2F8AE3;color: #fff;border-radius: 6px">保存</a>
                    <a href="javascript:void (0)" class="getBack"  style="
                margin-top: 25px;display: inline-block;
                line-height: 1;font-size:18px;padding: 8px 20px;background: #2F8AE3;color: #fff;border-radius: 6px">返回</a>

                </div>
            </div>
        </form>
    </div>
</div>
<script>
    // 获取地址栏参数值
    function getQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    var tag = getQueryString("tag");
    if(tag==1){
        $("#add").css('background','#2f8ae3')
        $("#add").css('padding','4px 13px')
        $('body').css('background','#f2f2f2')
        $('.content').css('padding-top','40px')
        $("#add").css('margin-top','0')
        $('#iframe13').css('display','none')

    }else{
        $("#add").css("display","none")
    }
    var organizeId=$.GetRequest().id;
    if(organizeId==undefined){
        organizeId='';
    }else{
        organizeId=organizeId;
    }



    $(document).on('click','.choose',function(){
        var type=$(this).attr('data-type');
        // $('.tableList').hide();
        // $('.mainBg').show();
        $('#gridName').val('');
        $('#organize').val('');
        if(type==0){//新建
            $('.tableList').hide();
            $('.mainBg').show();
            $('.preservation').attr('data-type','0');
            $('.preservation').show();
            use();
            refresh()
            $('.addPhotos').show();
            $('#datasave').attr('action','/subjectActivity/addSubjectActivity')
        }else  if(type==1){//查看
            var id=$(this).parents('tr').attr('id')
            $('.preservation').hide();
            $('.addPhotos').hide();
            noUser();
            // detail(id,type)
            look(id,type)
        }
        else{//修改
            $('.tableList').hide();
            $('.mainBg').show();
            var id=$(this).parents('tr').attr('id')
            $('.preservation').attr('data-type','2');
            $('.preservation').attr('data-id',id);
            $('.preservation').show();
            $('.addPhotos').show();
            $('#datasave').attr('action','/subjectActivity/updateSubjectActivity?sid='+id)
            use();
            detail(id,type)
        }
    })
    //    点击返回
    $('.getBack').click(function(){
        $('.tableList').show();
        $('.mainBg').hide();
    })
    //    禁用
    function noUser(){
        $('.mainBg input[type="text"]').attr('disabled','disabled');
        $('.mainBg input[type="radio"]').attr('disabled','disabled');
        $('#gridName').attr('disabled','disabled');
        $('#organize').attr('disabled','disabled');
        $('textarea').attr('disabled','disabled');
    }
    //    可以使用
    function use(){
        $('input[type="text"]').removeAttr('disabled');
        $('input[type="radio"]').removeAttr('disabled');
        $('textarea').removeAttr('disabled');
        $('#gridName').removeAttr('disabled');
        $('#organize').removeAttr('disabled');

    }
    //    点击全选
    $('#checkAll').click(function(){
        var state=$(this).prop('checked');
        if(state == true){
            $(this).prop('checked',true);
            $('.childCheck').prop('checked',true);
        }else{
            $(this).prop('checked',false);
            $('.childCheck').prop('checked',false);
        }
    })
    //    获取所属社区下拉框内容
    $.get('/gridInfo/gridSettingsTree?deptId=0&typeId=0',function (json) {
        if(json.flag){
            var str='<option value="">请选择</option>';
            for(var i=0;i<json.obj.length;i++){
                str+='<option value="'+json.obj[i].gridId+'">'+json.obj[i].gridName+'</option>'
            }
            $('#gridName').html(str)
        }
    })
    //    获取所属组织下拉框内容
    $.get('/orgDepartment/queryDepIdList',function (json) {
        if(json.flag){
            var str='<option value="">请选择</option>';
            for(var i=0;i<json.obj.length;i++){
                str+='<option value="'+json.obj[i].deptId+'">'+json.obj[i].deptName+'</option>'
            }
            $('#organize').html(str)
        }
    })
    //    分页列表
    var ajaxPageLe={

        data:{
            page:1,//当前处于第几页
            pageSize:10,//一页显示几条
            useFlag:true,
            organizeId:organizeId
            // computationNumber:null
        },
        page:function () {
            var me=this;
            $.ajax({
                url:'/subjectActivity/getList',
                type:'get',
                data:me.data,
                dataType:'json',
                success:function(reg){
                    var datas=reg.data;
                    if(datas != undefined){
                        var str="";
                        for(var i=0;i<datas.length;i++){
                            str+='  <tr id="'+datas[i].sid+'">' +
                                '                    <td>'+(i+1)+'</td>' +
                                // '                    <td>'+datas[i].communityName+'</td>' +
                                '                    <td>'+new Date(datas[i].subjectTime).Format('yyyy-MM-dd hh:mm:ss')+'</td>' +
                                // '                    <td style="color:#2F8AE3;cursor:pointer"><div class="lue choose" data-type="1" title="'+datas[i].subject+'">'+datas[i].subject+'</div></td>' +
                                '                    <td class="lue ">'+datas[i].subject+'</td>' +
                                '                    <td><div class="lue" title="'+datas[i].subjectContent+'">'+datas[i].subjectContent+'</div></td>' +
                                '                    <td>'+datas[i].joinNum+'</td>' +
                                '                    <td class="option">' +
                                function(){
                                    if(organizeId==""){
                                        var op=  '                        <a href="javascript:;" class="choose" data-type="1">查看</a>'+
                                            '                        <a href="javascript:;" class="choose up"  data-type="2">修改</a>' +
                                            '                        <a href="javascript:;" class="del de" >删除</a>'
                                        $('.option').html('操作');
                                        return op;
                                    }else{
                                        $('.option').html('');
                                        return ''
                                    }
                                }() +
                                '                    </td>' +
                                '                </tr>'
                        }
                        $('.list').html(str);
                        if(tag!=1){
                            $(".de").css("display","none")
                            $(".up").css("display","none")
                        }
                        if(reg.total>10){
                            $('#dbgz_page').show();
                            me.pageTwo(reg.total,me.data.pageSize,me.data.page)
                        } else {
                            $('#dbgz_page').hide();
                        }
                    }

                }
            })

        },
        pageTwo:function (totalData, pageSize,indexs) {
            var mes=this;
            $('#dbgz_page').pagination({
                totalData: totalData,
                showData: pageSize,
                jump: true,
                coping: true,
                homePage:'',
                endPage: '',
                current:indexs||1,
                callback: function (index) {
                    mes.data.page=index.getCurrent();
                    mes.page();
                }
            });
        }
    }
    ajaxPageLe.page();

    //    点击删除
    $('.list').on('click','.del',function(){
        var id=$(this).parents('tr').attr('id')
        layer.confirm(' 确定要删除吗', {
            btn: ['确定', '取消'], //按钮
            title: " 删除"
        },function(){
            $.ajax({
                url:'/subjectActivity/deleteSubjectActivity',
                type:'post',
                dataType:'json',
                data:{id:id},
                success:function(){
                    layer.msg(' 删除成功', {icon: 6});
                    ajaxPageLe.page();
                }
            })
        }, function () {
            layer.closeAll();
        })
    })

    //    上传图片
    function filesTwo(mes) {
        console.log(mes)
        var arr=mes.files;
        var bool=true;
        for(var i=0;i<arr.length;i++){
            if(arr[i].name.indexOf('.png')==-1&&arr[i].name.indexOf('.jpg')==-1&&arr[i].name.indexOf('.PNG')==-1&&arr[i].name.indexOf('.JPG')==-1){
                bool=false;
                break;
            }
        }
        if(!bool){
            $.layerMsg({content:'只能上传.png或.jpg格式！',icon:2});
            return
        }
        $('#datasave').prop('action','/flow/fileUpload?module=parameter')

        $('#datasave').ajaxSubmit({
            type:'post',
            dataType:'json',
            success:function (json) {
                if(json.flag) {
                    var str='';
                    var arr=json.datas;
                    var attStrId='';
                    var attStrName='';
                    for(var i=0;i<arr.length;i++){

//                        attStrId+=arr[i].attStrId+',';
//                        attStrName+=arr[i].attStrName+'*';
                        str+='<li class="pic" class="padding-left:10px;">' +
                            '<img src="/xs?'+arr[i].attUrl+'" alt="">' +
                            '<b class="deleClear">x</b>' +
                            '<input type="hidden" class="hiddenId" value="'+arr[i].attStrId+'">' +//id
                            '<input type="hidden" class="hiddenName" value="'+arr[i].attStrName+'">' +//名字
                            '</li>'
                    }
                    $(me).siblings('ul').append(str)
//                    $(me).prev().val(attStrId)
//                    $(me).next().val(attStrName)
                }else {
                    $.layerMsg({content:'该照片已经上传',icon:7})
                }

            }
        })

    }
    //    点击添加图片
    $('.addPhotos').click(function () {
        me=this;
        $('[name="file"]').click()
    })
    //    点击删除图片
    $(document).delegate('.deleClear','click',function () {
        $('input[type="file"]').val("")
        $(this).parent().remove()
    })

    //    点击保存
    $('.preservation').click(function(){
        var type=$(this).attr('data-type');
        if($('input[name="subject"]').val()==''){
            $.layerMsg({content:'请填写主题',icon:7});
            return;
        }
        if($('input[name="subjectTime"]').val()==''){
            $.layerMsg({content:'请填写时间',icon:7})
        } else if($('#gridName option:selected').val()==''){
            $.layerMsg({content:'请填写社区',icon:7})
        } else {
            if (type == 0) {//新建
                $('#datasave').attr('action', '/subjectActivity/addSubjectActivity')
                var attIdLen = $('.hiddenId').length;
                var attNameLen = $('.hiddenName').length;
                var attId = "";
                var attName = "";
                for (var i = 0; i < attIdLen; i++) {
                    attId += $('.hiddenId').eq(i).attr('value') + ','
                }
                for (var i = 0; i < attNameLen; i++) {
                    attName += $('.hiddenName').eq(i).attr('value') + '*'
                }
                $('input[name="attachmentId"]').val(attId)//图片id
                $('input[name="attachmentName"]').val(attName)//图片名称
                $('#datasave').ajaxSubmit({
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.flag) {
                            $.layerMsg({content: '新建成功', icon: 1})
                            $('.tableList').show();
                            $('.mainBg').hide();
                            ajaxPageLe.data.page = 1;
                            ajaxPageLe.page();
                        } else {
                            $.layerMsg({content: '新建失败', icon: 1})
                        }
                    }
                })
            } else if (type == 2) {
                var id = $(this).attr('data-id')
                $('#datasave').attr('action', '/subjectActivity/updateSubjectActivity?sid=' + id)
                var attIdLen = $('.hiddenId').length;
                var attNameLen = $('.hiddenName').length;
                var attId = "";
                var attName = "";
                for (var i = 0; i < attIdLen; i++) {
                    attId += $('.hiddenId').eq(i).attr('value') + ','
                }
                for (var i = 0; i < attNameLen; i++) {
                    attName += $('.hiddenName').eq(i).attr('value') + '*'
                }
                $('input[name="attachmentId"]').val(attId)//图片id
                $('input[name="attachmentName"]').val(attName)//图片名称
                $('#datasave').ajaxSubmit({
                    type: 'post',
                    dataType: 'json',
                    success: function (res) {
                        if (res.flag) {
                            $.layerMsg({content: '修改成功', icon: 1})
                            $('.tableList').show();
                            $('.mainBg').hide();
                            ajaxPageLe.data.page = 1;
                            ajaxPageLe.page();
                        } else {
                            $.layerMsg({content: '修改失败', icon: 1})
                        }
                    }
                })
            }
        }
    })

    //    查看详情
    function  detail(id,type) {
        $.ajax({
            url:'/subjectActivity/getSubjectActivityById',
            data:{id:id},
            dataType:'json',
            type:'get',
            success:function(res){
                var data=res.data;
                $('#gridName').val(data.community)
                $('#organize').val(data.organize)
//                $('input[name="community"]').val(data.community);
                $('input[name="subjectTime"]').val(new Date(data.subjectTime).Format('yyyy-MM-dd hh:mm:ss'))
//
                $('input[name="subject"]').val(data.subject);
                $('#subjectContent').val(data.subjectContent)
                $('input[name="joinNum"]').val(data.joinNum);
                $('#remark').val(data.remark);


                //                    图片显示
                var obj=data.attachmentList;
                var str1=""
                for(var i=0;i<obj.length;i++){
                    str1+='<li class="pic" class="padding-left:10px;">' +
                        '<img src="/xs?'+obj[i].attUrl+'" alt=""  style="cursor:pointer">' +function(){
                            if(type==1){
                                return ''
                            }else{
                                return '<b class="deleClear">x</b>';
                            }
                        }()+
                        '<input type="hidden" class="hiddenId"  value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                        '<input type="hidden"  class="hiddenName" value="'+obj[i].attachName+'">' +//名字
                        '</li>'
                }
                $('.prevTwo>ul').html(str1);
                $('input[name="attachmentId"]').val(data.attachmentId)
                $('input[name="attachmentName"]').val(data.attachmentName)
            }
        })
    }

    function look(id,type) {
        $.ajax({
            url:'/subjectActivity/getSubjectActivityById',
            data:{id:id},
            dataType:'json',
            type:'get',
            success:function(res){
                var data=res.data;
                //                    图片显示
                var obj=data.attachmentList;
                var str1=""
                for(var i=0;i<obj.length;i++){
                    str1+='<li class="pic" class="padding-left:10px;">' +
                        '<img src="/xs?'+obj[i].attUrl+'" alt=""  style="cursor:pointer">' +function(){
                            if(type==1){
                                return ''
                            }else{
                                return '<b class="deleClear">x</b>';
                            }
                        }()+
                        '<input type="hidden" class="hiddenId"  value="'+obj[i].aid+'@'+obj[i].ym+'_'+obj[i].attachId+'">' +//id
                        '<input type="hidden"  class="hiddenName" value="'+obj[i].attachName+'">' +//名字
                        '</li>'
                }
                // $('.prevTwo>ul').html(str1);
                $('input[name="attachmentId"]').val(data.attachmentId)
                $('input[name="attachmentName"]').val(data.attachmentName)
                layer.open({
                    type: 1,
                    title: '活动详情',
                    // shade: 0.5,
                    area: ['60%', '80%'],
                    btn:['关闭'],
                    content:
                        '<div class="mainBg" style="background: #fff;">\n' +
                        '        <form action="" id="datasave">\n' +
                        '            <input type="file"  onchange="filesTwo(this)" multiple="multiple" name="file"  style="display: none"/>\n' +
                        '            <div class="mainTitle" style="width: 90%;border:none;background: #f6f6f6;">\n' +
                        '                <ul class="mainTitleUl">\n' +
                        '                    <li style="    padding-top: 18px;text-align: center;height: 0 !important;border-bottom: none !important;"><span class="spanSize"></span> </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="">所属组织</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" name="organize" value="'+data.organize+'" id="organize" style="background: #fcfcfc;    width: 92%;   float: none;  margin-top: 9px;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="">活动时间<b style="color: red;">*</b></span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" name="subjectTime" value="'+res.time+'" placeholder="请填写活动时间" style="background: #fcfcfc;    width: 92%;   float: none;  margin-top: 9px;" >\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="">主题<b style="color: red;">*</b></span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" name="subject" value="'+data.subject+'" placeholder="请填写主题" style="background: #fcfcfc;    width: 92%; float: none; margin-top: 9px;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="height: 105px;line-height: 105px">活动内容</span>\n' +
                        '                        <label style="width: 80%;height: 105px;">\n' +
                        '                            <textarea name="subjectContent" id="subjectContent"  placeholder="请填写活动内容" style="background: #fcfcfc;font-size:14px;margin-top:9px;" readonly="readonly">'+data.subjectContent+'</textarea>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="">参加人数</span>\n' +
                        '                        <label style="width: 80%;">\n' +
                        '                            <input type="text" name="joinNum" value="'+data.joinNum+'" placeholder="请填写参加人数" style="background: #fcfcfc;    width: 92%;  float: none;    margin-top: 9px;">\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="height: 100px;line-height: 100px">照片</span>\n' +
                        '                        <label style="width: 80%;height: 100px;">\n' +
                        '                            <div class="picture prevTwo" style="position: relative;width: 89%;border: none">\n' +
                        '                                <input type="hidden" name="attachmentId">\n' +
                        // '                                <img class="fl addPhotos" style="    width: 60px;cursor: pointer;  height: 60px;margin-top: 4px; margin-right: 7px;" src="/img/grid/addtupin.png" alt="添加照片">\n' +
                        '                                <input type="hidden" name="attachmentName">\n' +
                        '                                <ul class="fl" style="height: auto;">'+str1+'</ul>\n' +
                        '                            </div>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                    <li class="bordercolor clearfix">\n' +
                        '                        <span style="height: 105px;line-height: 105px">备注</span>\n' +
                        '                        <label style="width: 80%;height: 105px;">\n' +
                        '                            <textarea name="remark" id="remark"  placeholder="请填写备注" style="background: #fcfcfc;font-size:14px;margin-top:9px;" readonly="readonly">'+data.remark+'</textarea>\n' +
                        '                        </label>\n' +
                        '                    </li>\n' +
                        '                </ul>\n' +

                        // '                <div style="height: 88px;line-height: 88px;text-align: center">\n' +
                        // '                    <a href="javascript:void (0)" class="preservation" style=" margin-top: 25px;display: inline-block;margin-right: 10px; line-height: 1;font-size:18px;padding: 8px 20px; background: #2F8AE3;color: #fff;border-radius: 6px">保存</a>\n' +
                        // '                    <a href="javascript:void (0)" class="getBack"  style=" margin-top: 25px;display: inline-block;line-height: 1;font-size:18px;padding: 8px 20px;background: #2F8AE3;color: #fff;border-radius: 6px">返回</a>\n' +
                        // '                </div>\n' +
                        '            </div>\n' +
                        '        </form>\n' +
                        '    </div>',
                    success:function(res){
                        $('input').css('border','none')
                        $('input').attr('readonly','readonly')
                        $('textarea').css('border','none')
                    }
                    ,yes: function(index, layero){
                        layer.close(index)
                        $('textarea').css('border','1px solid #DFE4EB')
                        $('input').css('border','1px solid #DFE4EB')
                        $('input[type="text"]').removeAttr('readonly');
                    }
                })
            }
        })
    }

    //    重置
    function refresh(){
        $('#gridName').find('option[value=""]').attr('selected',true)
        $('#organize').find('option[value=""]').attr('selected',true)
        $('input[name="community"]').val('');
        $('input[name="subjectTime"]').val('')
//
        $('input[name="subject"]').val('');
        $('#subjectContent').val('')
        $('input[name="joinNum"]').val('');
        $('#remark').val('');
        $('.prevTwo>ul').html("")
    }
    $(document).on('click','.pic img',function () {

        var imgs=$(this).attr('src')
        var wt=$(document.body).width()-800
        var ht=$(document.body).height()-500
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['auto'],
            offset:'100px',
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content:
                '<img src="'+imgs+'" width="'+wt+'" height="'+ht+'">'
        });
    })

    // $(document).on('click','.layui-layer-content',function () {
    //     layer.closeAll()
    // })


</script>
</body>
</html>
<script type="text/javascript">
    window.onload = function(){
        var _iframe3 = window.parent;
        var _div3 =_iframe3.document.getElementById('iframe3');
        // _div3.style.display = 'block';
    }
</script>
